/**
 * Integer Comparator. compare {@link Integer} values - using auto-boxing is advised 
 */
public class IntegerComparator implements Comparator {
	public int compare(Object o1, Object o2) {
		int ans = 666;
		if ((o1 instanceof Integer) && (o2 instanceof Integer)){
			
			int i1=(Integer)o1;
			int i2=(Integer)o2;
			if (i1>i2)
				ans=1;
			else if (i1<i2)
				ans=-1;
			else
				ans=0;
		}
		else 
			throw new RuntimeException("Cannot compare between objects");
		return ans;
	}
}
